home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / procssng / ccs / ccs-11tl.lha / lbl / sun / lib2 / time-out.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-14  |  554 b   |  39 lines

  1. /*    time-out . c
  2. %
  3. %    set time limit for free distribution
  4. */
  5.  
  6. #include <time.h>
  7. #include "imagedef.h"
  8.  
  9. static    struct tm    tl_out;
  10.  
  11. struct tm *
  12. set_time_limit(y, m, d, h, min)
  13. {
  14.  
  15. tl_out.tm_sec = 0;
  16. tl_out.tm_min = min;
  17. tl_out.tm_hour = h;
  18. tl_out.tm_mday = d;
  19. tl_out.tm_mon = m-1;
  20. tl_out.tm_year = y;
  21. return    &tl_out;
  22. }
  23.  
  24. if_time_exp(tm_in)
  25. time_t    tm_in;
  26. {
  27. return    tm_in > timelocal(&tl_out);
  28. }
  29.  
  30. exit_timeout(omsg, y, m, d, h, min)
  31. char    omsg[];
  32. {
  33. time_t    t0;
  34.     message(omsg, m, d, y);
  35.     set_time_limit(y, m, d, h, min);
  36.     if (if_time_exp(time(&t0)))     exit(0);
  37. }
  38.  
  39.